﻿<!DOCTYPE>

<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=EDGE;IE=11;IE=8,chrome=1" />
    <title>WMS物流信息回传</title>
    <link href="/InSiteWebApplication/Content/Easyui/themes/metro/easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/custom-easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/themes/icon.css" rel="stylesheet" />
    <style type="text/css">
        .linkbutton{margin-left:20px;}
         table tr td{padding:0px 5px}
         .divLabel2 td{text-align: end;text-align: left;font-size:12px;}
         .divLabel{display:none;}
    </style>
</head>
<body>
 <div class="panelSection">    
        <div class="easyui-panel " title="查询区域" style="padding:3px;width: 100%" 
        data-options="closable:false,collapsible:true,minimizable:false,maximizable:false">
        <form id="searchForm" style="margin-bottom: 2px;">
               <table>
                <tr class="divLabel2">
                    <td>生产订单号：</td>
                    <td>批次号：</td>
                    <td>物流单号：</td>
                    <td>物流状态：</td>
                </tr>
                <tr>
                    <td><input id="txtMfgorderName" class="easyui-textbox" name="MfgorderName" type="text" style="width: 120px; height: 22px" /></td>
                    <td><input id="txtContainerName" class="easyui-textbox" name="ContainerName" type="text" style="width: 120px; height: 22px" /></td>
                    <td><input id="txtWaybillNo" class="easyui-textbox" name="WaybillNo" type="text" style="width: 120px; height: 22px" /></td>
                    <td><input id="txtwaybillStatus" class="easyui-combobox" name="waybillStatus" type="text" style="width: 120px; height: 22px" /></td>
                    <td><a href="javascript:void(0)" id="btnSearch" class="easyui-linkbutton"   onclick="page.searchData()">查询</a>
                    <a href="javascript:void(0)" id="btnReset" class="easyui-linkbutton"   onclick="page.searchReset()">重置</a>
                    </td>
                </tr>
            </table>
        </form> 
        </div> 
    </div> 
      <div class="panelSection">    
        <div class="easyui-panel " title="物流信息回传信息" style="padding:3px;width: 100%" data-options="closable:false,collapsible:true,minimizable:false,maximizable:false"> 
        <div class="easyui-layout" style="width:100%;height:696px;">
                <table id="WaybillTable" style="height:665px;width:100%"></table>
                     <div id="pp" style="float: right" class="easyui-pagination" data-options="   
                         layout:['first','prev','next','last','manual','info'],              
                            total: 0,
                            showPageList: false,
                            showPageInfo: false,
                            showRefresh: false,
                            afterPageText:'共&nbsp{pages}&nbsp页',
                             buttons:[{
                                    iconCls:'',
                                    text:'Go',
                                    id:'pageGo'
                            }]
                        ">
                            </div>
	</div>
        </div>
      </div>
      <div id="statusMessage" style="font-size: 14px; height: 40px"></div>
</body>
</html>
<script src="/InSiteWebApplication/Scripts/CustomPageJs/ReferenceJsLib.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.easyui.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/easyui-lang-zh_CN.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Scripts/CustomPageJs/CustomCommon.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Scripts/array.pollyfill.js" type="text/javascript"></script>

<script type="text/javascript">
    /*
    创建人：longb
    日期：2025-09-18
    描述：物流信息回传信息
    */
    var page = {
        pagetotal: 0,
        pageSize: 20,
        pageNumber: 1,
        factoryName: null,
        ajaxUrl: getRootPath() + "/Ashx/MfgorderContainerProductFamilyHandler.ashx",
        //初始化页面
        init: function () {
            page.bind();
            NewcustomizedEasyuiPagination('pp'); //定制化分页
            $('#pp').find('.pageSize').val(page.pageSize); //初始化行数
        },
        //页面事件绑定
        bind: function () {
            $('#txtwaybillStatus').combobox({
                data: [{ id: '', text: '全部' }, { id: '1', text: '运输中' }, { id: '2', text: '已送达' }, { id: '3', text: '已领用'}],
                valueField: 'id',
                textField: 'text',
                value: '1'
            });
            //物流信息回传信息
            $("#WaybillTable").datagrid({
                checkOnSelect: false,
                selectOnCheck: false,
                singleSelect: true,
                rownumbers: true,
                onLoadSuccess: function (data) {
                    $('#pp').pagination('refresh', {	// 改变选项，并刷新分页栏信息
                        total: page.pagetotal,
                        pageSize: page.pageSize,
                        pageNumber: page.pageNumber
                    });
                    NewcustomizedEasyuiPagination('pp'); //定制化分页
                },
                columns: [[
                 { field: 'ck', title: '选择', checkbox: true },
                 { field: 'MFGORDERNAME', title: '订单号', width: 150 },
                 { field: 'BATCHNUM', title: '批次号', width: 170 },
                 { field: 'SPECNO', title: '工序号', width: 150 },
                 { field: 'WAY_NO', title: '物流单号', width: 150 },
                 { field: 'WAY_STATUS', title: '物流状态', width: 150, formatter: function (value, row, index) {
                     return value == 1 ? "运输中" : (value == 2 ? "已送达" : "已领用");
                 } 
                 },
                 { field: 'PICKDATE', title: '提货时间', width: 170 },
                 { field: 'DLVDATE', title: '送达时间', width: 170 },
                 { field: 'RCVDATE', title: '领用时间', width: 170 }
	           ]]
            });
            //分页事件
            $('#pp').pagination({
                onSelectPage: function (pageNumber, pageSize) {
                    NewcustomizedEasyuiPagination('pp'); //定制化分页
                    page.pageSize = pageSize; page.pageNumber = pageNumber;
                    page.getWayCallbackWMSData();
                }
            });
            //绑定分页go按钮
            $('#pageGo').on("click", function () {
                var pageNumber = $(this).parents('tr').find('.pagination-num').val();
                page.pageNumber = pageNumber;
                page.pageSize = $('#pp').find('.pageSize').val() == "" ? page.pageSize : Number($('#pp').find('.pageSize').val());
                page.getWayCallbackWMSData();
            });
            //清除按钮
            $('#btnReset').on("click", function () {
                page.reset(true, true, true);
            });
        },
        //查询
        searchData: function () {
            page.reset(false, true, true);
            page.pageNumber = 1;
            page.getWayCallbackWMSData();
        },
        //查询
        getWayCallbackWMSData: function () {
            var frdata = $('#searchForm').serializeArray();
            var data = {};
            $.each(frdata, function () {
                data[this.name] = this.value
            });
            var param = {
                action: "GetWayCallbackWMSData",
                pageSize: page.pageSize,
                pageNumber: page.pageNumber,
                data: JSON.stringify(data)
            };
            page.post(null, param, function (res) {
                if (res.Result) {
                    page.pagetotal = res.RowCount;
                    $('#WaybillTable').datagrid('loadData', res.DBTable);
                }
            });
        },
        //查询重置
        searchReset: function () {
            page.reset(true, true, true);
        },

        //清除方法，重要！！！
        reset: function (iscondition, isresult, isDetail) {
            clearMessage();
            if (iscondition) {
                $("#txtWaybillNo").textbox("setValue", ""); //件号
                $("#txtContainerName").textbox("setValue", ""); //批产号
                $("#txtMfgorderName").textbox("setValue", ""); //订单号
                $("#txtwaybillStatus").textbox("setValue", ""); //订单型别
            }

            if (isresult) {
                clearEasyuiDataGrid("WaybillTable", 1); //查询结果列表
                page.pageNumber = 1; page.pagetotal = 0; //重置分页
                $('#pp').pagination('refresh', {
                    total: page.pagetotal,
                    pageSize: page.pageSize,
                    pageNumber: page.pageNumber
                });
            }
            if (isDetail) {

            }
        },
        //post数据
        post: function (url, param, callback) {
            $.ajax({
                type: "Post",
                url: url == null ? page.ajaxUrl : url,
                data: param,
                cashe: false,
                async: true,
                dataType: "json",
                beforeSend: function () {
                    $.messager.progress({ text: '', msg: '处理中...' });
                },
                success: function (data) {
                    $.messager.progress('close');
                    callback(data);
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    $.messager.progress('close');
                    displayMessage(XMLHttpRequest.responseText, false);
                }
            });
        }
    }
    $(function () {
        page.init();
    });

</script>
